﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _SqlUtil使用特殊类型参数
{
    class Program
    {
        static void Main(string[] args)
        {
            //DataTable dt = new DataTable();
            //dt.Columns.Add("Id", typeof(int));
            //dt.Columns.Add("Sex", typeof(int));

            //DataRow row = dt.NewRow();
            //row["Id"] = 1;
            //row["Sex"] = 1;
            //dt.Rows.Add(row);

            //string proName = "Pro_Get_PersonManager";

            //SqlParameter para = new SqlParameter("@UserTable", SqlDbType.Structured);
            //para.Value = dt;

            //DataTable result = new DataTable();
            //result = SqlUtil.GetDataTable(SqlUtil.connString, proName, CommandType.StoredProcedure, para);



            string strSql = "Select * from BaseTree where Id in (select * from fn_split(@Ids,','))";

            SqlParameter para=new SqlParameter("@Ids","1,2,3,4,5");

            DataTable dt = SqlUtil.GetDataTable(SqlUtil.connString, strSql, CommandType.Text, para);

            Console.WriteLine(dt.Rows);

            Console.ReadKey();

        }
    }
}
